.header {
  transition: all 0.3s ease;
  opacity: 1;
  transform: translateY(0);
  // 其他基础样式...
}
.header.hidden {
  opacity: 0;
  transform: translateY(-100%);
}
.header.visible {
  opacity: 1;
  transform: translateY(0);
}